package com.xnxy.design.config;


import com.xnxy.design.filter.LoginFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;

/**
 * 登录拦截器
 * @author puzengcheng
 * @date 2018/11/2
 */
@Configuration
public class WebConfig {


    @Bean
    public FilterRegistrationBean loginFilter() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(new LoginFilter());
        registration.addUrlPatterns("/*");
        registration.setName("checkLoginFilter");
        registration.setOrder(Ordered.HIGHEST_PRECEDENCE);
        return registration;
    }



}

